﻿<UserControl x:Class="Test.Silverlight.DataGrid.Customization"
    xmlns="http://schemas.microsoft.com/client/2007" 
    xmlns:local="clr-namespace:Test.Silverlight.DataGrid;assembly=Test.Silverlight.DataGrid"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:grid="clr-namespace:DevExpress.AgDataGrid;assembly=DevExpress.AgDataGrid.v8.2">

    <UserControl.Resources>
        <DataTemplate x:Name="OptionsPanelTemplate">
            <StackPanel x:Name="OptionsPanel" Orientation="Vertical" Loaded="OptionsPanel_Loaded">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Panel Visibility:" Margin="0,1,10,0" VerticalAlignment="Center"/>
    				<CheckBox x:Name="cbShowGroupPanel"
                      Checked="cbShowGroupPanel_IsCheckedChanged" 
                      Content="Show group panel"
                      Margin="0,0,10,0"
					  Unchecked="cbShowGroupPanel_IsCheckedChanged"/>
    				<CheckBox x:Name="cbShowColumnHeaders"
                      Checked="cbShowColumnHeaders_IsCheckedChanged"
                      Content="Show column headers"
                      Margin="0,0,10,0"
					  Unchecked="cbShowColumnHeaders_IsCheckedChanged"/>
    				<CheckBox x:Name="cbShowTotals"
                      Checked="cbShowTotals_IsCheckedChanged"
                      Content="Show totals"
                      Margin="0,0,10,0"
					  Unchecked="cbShowTotals_IsCheckedChanged"/>
                </StackPanel>
                <CheckBox x:Name="cbEvenOddRows"
                  Checked="cbEvenOddRows_Checked"
                  Content="Enable alternating row style"
                  HorizontalAlignment="Left"
                  Margin="-4,0,0,0"
                  Unchecked="cbEvenOddRows_Checked"/>
            </StackPanel>
        </DataTemplate>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot">
		<grid:AgDataGrid x:Name="grid" ColumnsAutoWidth="True">
            <grid:AgDataGrid.Resources>
                <local:CurrencyToStringConverter x:Name="CurrencyToStringConverter"/>
            </grid:AgDataGrid.Resources>
            <grid:AgDataGrid.Columns>
				<grid:AgDataGridTextColumn FieldName="Trademark" Width="200"/>
				<grid:AgDataGridTextColumn FieldName="Model" Width="250"/>
				<grid:AgDataGridTextColumn FieldName="HP" Width="50"/>
				<grid:AgDataGridTextColumn FieldName="Liter" Width="50"/>
				<grid:AgDataGridColumn FieldName="TransmissSpeedCount" Width="50" HeaderContent="Transmiss" PrepareCellDisplayElement="AgDataGridColumn_PrepareCellDisplayElement">
					<grid:AgDataGridColumn.CellDisplayTemplate>
						<DataTemplate>
							<TextBlock x:Name="SpeedText"/>
                        </DataTemplate>
					</grid:AgDataGridColumn.CellDisplayTemplate>
				</grid:AgDataGridColumn>
				<grid:AgDataGridTextColumn FieldName="Category" Width="100"/>
				<grid:AgDataGridColumn FieldName="Price" Width="100">
                    <grid:AgDataGridColumn.CellDisplayTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding CellValue, Converter={StaticResource CurrencyToStringConverter}}"/>
                        </DataTemplate>
                    </grid:AgDataGridColumn.CellDisplayTemplate>
                </grid:AgDataGridColumn>
            </grid:AgDataGrid.Columns>
            <grid:AgDataGrid.Totals>
                <grid:AgDataGridSummaryItem FieldName="Trademark" SummaryType="Count"/>
            </grid:AgDataGrid.Totals>
        </grid:AgDataGrid>
	</Grid>
    
</UserControl>
